#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <map>
#include <string>
#include <climits>
#include <algorithm>

using namespace std;

const int MAXN = 10;
const int INF = INT_MAX;
bool visit[MAXN];
char sequence[MAXN];
void DFS(int index, string str)
{
    if (index == str.size())
    {
        cout << sequence << endl;
    }
    else
    {
        for (int i = 0; i < str.size(); i++)
        {
            if (visit[i])
            {
                continue;
            }
            visit[i] = true;
            sequence[index] = str[i];
            DFS(index + 1, str);
            visit[i] = false;
        }
    }
}

int main()
{
    string str;
    while (cin >> str)
    {
        sort(str.begin(), str.end());
        DFS(0, str);
    }
}
